#define _CRT_SECURE_NO_WARNINGS
//计算n个阶乘的和 ׳֮1+2!+....n!
#include <stdio.h>
int main()
{
	int i,n;
	int ret = 1, sum = 0;
	scanf("%d",&n);
	
		for (i = 1; i <= n; i++)
	{
		ret *= i;
		sum += ret;
	}

	printf("sum=%d\n", sum);
	return 0;
}